<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/01.css">
    <link rel="stylesheet" href="css/02.css">
    <link rel="stylesheet" href="css/common.css">
    <style>
        main {
            width: 100%;
            height: 500px;
            background: url(img/bjbenchi.jpg)no-repeat;
            background-size: 100%;
            opacity: 0.8;
            overflow: hidden;
        }

        main #list {
            width: 800px;
            height: 500px;
            padding-top: 100px;
            /* float: left; */
            margin: 0 auto;
        }

        main #listtemp {
            display: none;

        }

        main li {
            list-style: none;
            padding: 17px;
            font-size: 20px;
            float: left;
        }
    </style>
    <script src="jquery.min.js"></script>
    <script>


        let http = new XMLHttpRequest()
        http.open("get", `http://127.0.0.1:8080/getlist?`);
        http.send();
        http.onreadystatechange = function () {
            if (http.readyState === 4) {
                let data = JSON.parse(http.responseText);
                console.log(data)
                let tem = $("main #listtemp");
                let list = $("main #list")
                data.forEach(item => {
                    let newitem = tem.clone();
                    newitem.attr("id", "").find("a").html(item.name).attr("href", `delist01.html?id=${item.id}`);

                    newitem.appendTo(list)
                })


            }
        }
    </script>


    <!-- <link rel="stylesheet" href="css/common.css"> -->



</head>

<body>
    <header id="head"></header>

    <main>

        <ul id="list">
            <li id="listtemp">
                <a href="delist01.html">
            </li>


        </ul>

    </main>
    <div id="foot"></div>

    </script>
</body>

</html>
<script src="js/jquery.min.js"></script>
<!-- <script src="js/01.js"></script> -->
<script>
    $('#head').load('head.html');

    $("#head .p1").html(sessionStorage.getItem("userinfor"))


    $('#foot').load('foot.html');
</script>